import os

import django
from celery import Celery, platforms
from django.conf import settings

os.environ.setdefault('DJANGO_SETTINGS_MODULE', "application.settings")
django.setup()

app = Celery(f"dvadmin") # TODO 可能得设置成dvadmin-backend

app.config_from_object('django.conf:settings') #  app.config_from_object('django.conf:settings', namespace='CELERY') 使用CELERY_ 作为前缀，在settings中写配置
app.autodiscover_tasks(lambda: settings.INSTALLED_APPS) # 发现任务文件每个app下的task.py
platforms.C_FORCE_ROOT = True
